package com.linkstec.service;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.linkstec.websocket.WebSocketServer;

@Service
@EnableScheduling
public class WebSocketServiceImpl {

	// 打印时间
	@Scheduled(fixedRate = 5000) // 1000毫秒执行一次
	public void printTime() {

		SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
		String date = dateFormat.format(new Date());
		WebSocketServer.sendInfo(date, "10");
		System.out.println(date);
	}

}